import { defineStore } from 'pinia';
import { Local } from '@/utils/storage';
import { nextTick } from 'vue';
export const useLayoutConfigStore = defineStore('layoutConfig', {
    state: (): LayoutConfigState => {
        return {
            isCollapse: false,
            globalTitle: '项财一体化系统',
            isFullscreen: false,
            isDrak: false,
        }
    },
    getters: {

    },
    actions: {
        //更新状态
        updateState(state: LayoutConfigState) {
            //将传递的对象属性值更新到state状态中
            this.$patch(state);
        }
    }
});

nextTick(() => {
    const layoutConfig = useLayoutConfigStore();
    //监听状态变化
    layoutConfig.$subscribe((mutation,state) => {
        Local.set('layoutConfig' , state);
    })
});

